package com.sqx.modules.goods.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.sqx.modules.goods.entity.Goods;
import com.sqx.modules.goods.vo.GoodsVo;
import com.sqx.modules.scFollow.entity.ScFollow;
import com.sqx.modules.trends.vo.TrendsVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import javax.validation.constraints.Past;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Set;

/**
 * <p>
 * 商品 Mapper 接口
 * </p>
 *
 * @author wuChang
 * @since 2024-05-30
 */
@Mapper
public interface GoodsDao extends BaseMapper<Goods> {

    IPage<GoodsVo> getAdminGoodsList(@Param("pages") Page<GoodsVo> pages, @Param("goodsVo") GoodsVo goodsVo);

    IPage<GoodsVo> getRecycleGoodsList(@Param("pages")Page<GoodsVo> pages,@Param("goodsVo") GoodsVo goodsVo);

    IPage<GoodsVo> getGoodsList(@Param("pages") Page<GoodsVo> pages, @Param("goodsVo") GoodsVo goodsVo);

    IPage<GoodsVo> getGoodListByIsRecommend(@Param("pages")Page<GoodsVo> pages,@Param("goodsVo") GoodsVo goodsVo);
    IPage<GoodsVo> getGoodsListByCity(@Param("pages") Page<GoodsVo> pages, @Param("goodsVo") GoodsVo goodsVo);

    Page<Goods> getMyGoodsList(@Param("pages") Page<Goods> pages, @Param("goods") Goods goods);

    GoodsVo getGoodsById(@Param("goodId") Long goodId, @Param("loginUserId") Long loginUserId);

    Page<Goods> getFollowGoodsList(@Param("pages") Page<GoodsVo> pages, @Param("userId") Long userId, @Param("follow") ScFollow follow);


    IPage<Goods> getGoodsByCoordinates(@Param("typeId") Long typeId,
                                       @Param("pages") Page<GoodsVo> pages,
                                       @Param("lat") Double lat,
                                       @Param("lng") Double lng);

    List<Long> getTypeIdsByGoodIds(@Param("goodIds") List<Long> goodIds);

    List<Goods> selectDynamicHomepage(@Param("params") Map<String, Object> params);

    Goods selectByUserId(@Param("userId") Long userId, @Param("taskId") Long taskId);

    IPage<GoodsVo> getGoodsByTypeExcludingId(@Param("pages") Page<GoodsVo> pages,
                                             @Param("typeIds") Set<Long> typeIds,
                                             @Param("allGoodIds") Set<Long> allGoodIds,
                                             @Param("goodsVo")GoodsVo goodsVo);

    Integer selectNeedCount(@Param("byUserId")Long byUserId);
    Integer selectNeedCount1(@Param("byUserId")Long byUserId);

    IPage<GoodsVo> getGoodsByIsRecommend(@Param("pages") Page<GoodsVo> pages,@Param("goodsVo") GoodsVo goodsVo);
    IPage<GoodsVo> getGoodsByIsRecommend1(@Param("pages") Page<GoodsVo> pages,@Param("goodsVo") GoodsVo goodsVo);

    IPage<GoodsVo> getGoodsByIsRecommendByPrice(@Param("pages")Page<GoodsVo> pages,@Param("goodsVo") GoodsVo goodsVo);

    IPage<GoodsVo> getGoodsListByPrice(@Param("pages")Page<GoodsVo> pages,@Param("goodsVo") GoodsVo goodsVo);

    IPage<GoodsVo> getGoodsBySearchList(@Param("pages")Page<GoodsVo> pages,@Param("goodsVo") GoodsVo goodsVo);

    Page<Goods> selectPageByUserId(@Param("pages")Page<GoodsVo> pages,@Param("byUserId")Long byUserId);

    IPage<Goods> queryPageByUserId(@Param("pages")Page<Goods> pages,@Param("byUserId")Long byUserId);

    Integer countByGoodId(@Param("goodId")Long goodId);

    int updateByGoodId(@Param("goodId") Long goodId,@Param("totalPrice") BigDecimal totalPrice);
}
